<?

//function runSQL($rsql) {
//
//	$db['default']['hostname'] = "localhost";
//	$db['default']['username'] = '';
//	$db['default']['password'] = "";
//	$db['default']['database'] = "";
//
//	$db['live']['hostname'] = 'localhost';
//	$db['live']['username'] = '';
//	$db['live']['password'] = '';
//	$db['live']['database'] = '';
//
//	$active_group = 'default';
//
//	$base_url = "http://".$_SERVER['HTTP_HOST'];
//	$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
//	if (strpos($base_url,'webplicity.net')) $active_group = "live";
//
//	$connect = mysql_connect($db[$active_group]['hostname'],$db[$active_group]['username'],$db[$active_group]['password']) or die ("Error: could not connect to database");
//	$db = mysql_select_db($db[$active_group]['database']);
//
//	$result = mysql_query($rsql) or die ($rsql);
//	return $result;
//	mysql_close($connect);
//}
//
//function countRec($fname,$tname) {
//	$sql = "SELECT count($fname) FROM $tname ";
//	$result = runSQL($sql);
//	while ($row = mysql_fetch_array($result)) {
//		return $row[0];
//	}
//}
//$page = $_POST['page'];
//$rp = $_POST['rp'];
//$sortname = $_POST['sortname'];
//$sortorder = $_POST['sortorder'];
//
//if (!$sortname) $sortname = 'name';
//if (!$sortorder) $sortorder = 'desc';
//
//$sort = "ORDER BY $sortname $sortorder";
//
//if (!$page) $page = 1;
//if (!$rp) $rp = 10;
//
//$start = (($page-1) * $rp);
//
//$limit = "LIMIT $start, $rp";
//
//$query = $_POST['query'];
//$qtype = $_POST['qtype'];
//
//$where = "";
//if ($query) $where = " WHERE $qtype LIKE '%$query%' ";
//
//$sql = "SELECT iso,name,printable_name,iso3,numcode FROM country $where $sort $limit";
//$result = runSQL($sql);
//
//$total = countRec("iso","country $where");


$row['page'] = 1;
$row['total'] = 10;
$row['rows'][0]['id']='10';
$row['rows'][0]['cell'] = array('1','2','3','4','5');

$row['rows'][1]['id']='11';
$row['rows'][1]['cell'] = array('1','2','3','4','5');
$json = json_encode($row);

//$json = "";
//$json .= "{\n";
//$json .= "page: 1,\n";
//$json .= "total: 10,\n";
//$json .= "rows: [";
$rc = false;
//while ($row = mysql_fetch_array($result)) {
	//if ($rc) $json .= ",";
//	$json .= "\n{";
//	$json .= "id:'".'$row[]'."',";
//	$json .= "cell:['".'$row["iso"]'."'";
//	$json .= ",'".addslashes('$row["name"]')."'";
//	$json .= ",'".addslashes('$row["printable_name"]')."'";
//	$json .= ",'".addslashes('$row["iso3"]')."'";
//	$json .= ",'".'$row["numcode"]'."']";
//	$json .= "}";
	//$rc = true;
//}
//$json .= "]\n";
//$json .= "}";
echo $json;
?>